const api = require('../../config/home.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    swiperCurrent: 0,
    indicatorDots: true,
    autoplay: false,
    interval: 2000,
    duration: 500,
    durations:8000,
    interval: 30,
    circular: true,
    imgUrls: [
      

    ],
    imgUrls1:'https://p3.pstatp.com/large/43700001e49d85d3ab52',
    value: '',
    homeList: ['招聘', '招标', '拿地'],
    supplierList: ['排名', '工艺'],
    adList: ['公司概况', '项目']
  },
  swiperChange (e) {
    let {current, source} = e.detail
    if(source === 'autoplay' || source === 'touch') {
    this.setData({
      swiperCurrent:current
    })
  }
  },
  swipclick (e) {
    const {advertisementtype,id} = e.target.dataset
    wx.navigateTo({
      url: `/pages/everyLunbo/index?advertisementtype=${advertisementtype}&id=${id}`
   });
  },
  goSearch () {
    wx.navigateTo({
      url: '/pages/searchDetail/index'
    });
  },
  gomore() {
    wx.navigateTo({
      url:'/pages/more/index'
    })
  },
  lunboList() {
    wx.request({
      url: api.lunboList, //仅为示例，并非真实接口地址。
      data: {
        current:1,
        pageSize:4
      },
     method:'GET',
      success: (res) => {
        if(res.data.code === 100) {
          let obj = res.data.object.records
          // let imgs = obj.map(item => {return item.advertisementImage})
          this.setData({
            imgUrls:obj
          })
        }
        
      }
    });
  },
  

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.lunboList()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})